package com.xizi.collection;

import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;

public class LinkedHashSetTest {


    public static void main(String[] args) {
        LinkedHashSet<Integer> set = new LinkedHashSet<>();
        set.add(4);
        set.add(1);
        set.add(3);
        set.add(null);
        Iterator<Integer> iter = set.iterator();
        while (iter.hasNext()) {
            System.out.println(iter.next());
        }
        System.out.println("-------------------------------");
        HashSet<Integer> set1 = new HashSet<>();
        set1.add(4);
        set1.add(1);
        set1.add(3);
        set1.add(null);
        Iterator<Integer> iter1 = set1.iterator();
        while (iter1.hasNext()) {
            System.out.println(iter1.next());
        }
    }

}